**********************************
*	Title: indiv04.do
*	Date: 18 Sept 2006
*	Author: Zoe McLaren
*	Description: 
*			1. Cleans and appends cleaned adultyouth, child and youngchild data sets
*
**********************************


*Clean adult, child and youngchild data sets
do "$syntax/aux_vars_ZAF.do"
do "$syntax/child_ZAF.do"
do "$syntax/youngchild_ZAF.do"

*Append cleaned adult, child, youngchild data sets
use "$data/aux_vars_ZAF.dta", clear
gen group=1 	 
lab def group 1 "adultyouth" 2 "child 12-14" 3 "child 2-11"
lab val group group
quietly append using "$data/childauxvars_ZAF.dta"
replace group=2 if group==.
quietly append using "$data/youngchild_ZAF.dta"
replace group=3 if group==.
count

*GENERATE some additional variables
gen agegroup=1 if age>=2 & age<=14
replace agegroup=1 if group==2 | group==3
replace agegroup=2 if age>=15 & age<=24
replace agegroup=3 if age>=25 & age<=39
replace agegroup=4 if age>=40 & age<. 
lab def agegroup 1 "age 2-14" 2 "age 15-24" 3 "age 25-39" 4 "age 40 and over"
lab val agegroup agegroup

exit
